#include<iostream>
using namespace std;
const int N = 110;
int dp[N][N];
int n, m;
void fun()
{
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= i; j++) {
			if (!j) dp[i][j] = 1;
			else {
				dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j];
			}
		}
	}
}
int main()
{
	int t;
	cin >> t;
	fun();
	while (t--) {
		cin >> n >> m;
		cout << dp[n][m] << endl;
	}
	return 0;
}